package com.poh.service.impl;

import com.poh.mapper.HomeworkMapper;
import com.poh.pojo.Homework;
import com.poh.service.HomeworkService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.UUID;

@Service
public class HomeworkServiceImpl implements HomeworkService {
    @Autowired
    HomeworkMapper homeworkMapper;
    @Override
    public int addHomework(Homework homework) {
//        LocalDate localDate = LocalDate.now();
//        LocalTime localTime = LocalTime.now();
//        homework.setHomeworkTime(localDate.format(DateTimeFormatter.ISO_DATE) + " " + localTime);
//        homework.setHomeworkState(0);
        return homeworkMapper.addHomework(homework);
    }

    @Override
    public int updateHomework(Homework homework) {
        return homeworkMapper.updateHomework(homework);
    }

    @Override
    public int deleteHomework(String homeworkId) {
        return homeworkMapper.deleteHomework(homeworkId);
    }

    @Override
    public List<Homework> queryHomeworkByCourseId(int courseId) {
        return homeworkMapper.queryHomeworkByCourseId(courseId);
    }

    @Override
    public int releaseHomework(Homework homework) {
        return homeworkMapper.releaseHomework(homework);
    }

    @Override
    public Homework queryHomeworkById(String homeworkId) {
        return homeworkMapper.queryHomeworkById(homeworkId);
    }

    @Override
    public List<Homework> queryHomeworkByCourseIdWithoutScore(int courseId) {
        return homeworkMapper.queryHomeworkByCourseIdWithoutScore(courseId);
    }

    @Override
    public int updateHomeworkStatusById(String homeworkId, int homeworkStatus) {
        return homeworkMapper.updateHomeworkStatusById(homeworkId, homeworkStatus);
    }
}
